using System.Windows.Documents;
using com.bodurov.SilverlightControls.XmlCodeEditor.Utils;

namespace com.bodurov.SilverlightControls.XmlCodeEditor.Extensions
{
    public static class TextSelection_Ext
    {
        public static bool OverlapsWith(this TextSelection selection, TextElement element)
        {
            if (element == null) return false;
            return (selection.Start.CompareTo(element.ContentEnd) + selection.End.CompareTo(element.ContentStart)) == 0;
        }
    }
}